<?php
$table = $console->argument('table');
$className = $console->argument('className');

$className = explode('/',$className) ;
$trueClassName = array_pop($className) ;


$subNameSpace = implode('\\',$className) ;
if($subNameSpace){
    $subNameSpace = '\\'.$subNameSpace ;
}

echo '<?php';
?>


namespace App\models<?=$subNameSpace?>;
use App\models\Base;
/**
* This is the model class for table "<?=$table?>".
*
<?php
$fillable = [] ;
$primaryCol = null ;
foreach ($colmns as $col){
    if($col->Extra != 'auto_increment'){
        $fillable[] = "'{$col->Field}'" ;
    }else{
        $primaryCol = $col ;
    }
    echo "* @property {$col->show_type} \${$col->Field} \n" ;
}
?>
*/
class <?=$trueClassName?> extends Base
{

    // 自动时间戳对应的变量
    //const CREATED_AT = 'created_at';
    //const UPDATED_AT = 'updated_at';

    protected $primaryKey = '<?=$primaryCol == null ? 'id' : $primaryCol->Field?>';

    // 是否需要自动时间戳
    //public $timestamps = false;

    // 时间的格式类型
    //protected $dateFormat = 'Y-m-d';

    //protected $connection = 'default';

    protected $table = '<?=$table?>';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        <?=implode(',',$fillable)."\n"?>
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [

    ];
}
